﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Net4.Common.Entities
{
    public enum Category
    {
        News = 0,
        Movie = 1
    }

    public class Article
    {
        #region Properties

        private int _Id;

        public int Id
        {
            get { return _Id; }
            set { _Id = value; }
        }
        private string _Title;

        public string Title
        {
            get { return _Title; }
            set { _Title = value; }
        }
        private string _Author;

        public string Author
        {
            get { return _Author; }
            set { _Author = value; }
        }
        private DateTime _CreateDate;

        public DateTime CreateDate
        {
            get { return _CreateDate; }
            set { _CreateDate = value; }
        }
        private DateTime _LastModifiedDate;

        public DateTime LastModifiedDate
        {
            get { return _LastModifiedDate; }
            set { _LastModifiedDate = value; }
        }
        private int _Hits;

        public int Hits
        {
            get { return _Hits; }
            set { _Hits = value; }
        }
        private string _Tags;

        public string Tags
        {
            get { return _Tags; }
            set { _Tags = value; }
        }
        private string _Content;

        public string Content
        {
            get { return _Content; }
            set { _Content = value; }
        }
        private string _Description;

        public string Description
        {
            get { return _Description; }
            set { _Description = value; }
        }
        private string _Photos;

        public string Photos
        {
            get { return _Photos; }
            set { _Photos = value; }
        }

        private List<Attachment> _Attachments;

        public List<Attachment> Attachments
        {
            get 
            {
                if (_Attachments == null)
                {
                    _Attachments = new List<Attachment>();
                }
                return _Attachments; 
            }
            set { _Attachments = value; }
        }

        private Category _Category = Category.News;

        public Category Category
        {
            get { return _Category; }
            set { _Category = value; }
        }

        #endregion

        public Article(int id, string title, string author, DateTime createDate, DateTime lastModifiedDate, 
            int hits, string tags, string content, string description, string photos, Category category)
        {
            _Id = id;
            _Title = title;
            _Author = author;
            _CreateDate = createDate;
            _LastModifiedDate = lastModifiedDate;
            _Hits = hits;
            _Tags = tags;
            _Content = content;
            _Description = description;
            _Photos = photos;
            _Category = category;
        }

        public Article(string title, string author, string tags, string content,
            string description, string photos, Category category)
        {
            _Title = title;
            _Author = author;
            _CreateDate = DateTime.Now;
            _LastModifiedDate = DateTime.MinValue;
            _Hits = 0;
            _Tags = tags;
            _Content = content;
            _Description = description;
            _Photos = photos;
            _Category = category;
        }
    }
}
